package com.ynny.librarysystemmanager.service.impl;

import com.ynny.librarysystemmanager.entity.User;
import com.ynny.librarysystemmanager.mapper.UserMapper;
import com.ynny.librarysystemmanager.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;

import java.util.List;

public class UserServiceImpl implements UserService {
    @Autowired
    private UserMapper userMapper;

    @Override
    public List<User> findAll(User user) {

        return userMapper.selectAll(user);

    }

    @Override
    public User findOne(Integer userId) {
        return userMapper.selectOne(userId);
    }

    @Override
    public int addUser(User user) {

        return userMapper.insert(user);
    }

    @Override
    public int updateUser(User user) {
        return userMapper.update(user);
    }

    @Override
    public int disableUser(Integer userId , Integer status) {
        return userMapper.delete(userId , status);
    }

}
